using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

[System.Serializable]
public class Item
{
    public int id;
    public int num;

    public Item(int id, int num)
    {
        this.id = id;
        this.num = num;
    }
}

public class PlayerInfo
{
    public string name;
    public int atk;
    public int def;
    public float moveSpeed;
    public double roundSpeed;
    public Item weapon;
    public List<int> listInt;
    public List<Item> itemList;
    public Dictionary<int, Item> itemDic;
    public Dictionary<string, Item> itemDic2;
    [SerializeField]
    private int privateI = 1;
    [SerializeField]
    protected int protectedI = 2;

}


public class Test1 : MonoBehaviour
{
    
    void Start()
    {
        PlayerInfo info1 = new PlayerInfo();
        info1.name = "lik";
        info1.atk = 1;
        info1.def = 5561;
        info1.moveSpeed = 6;
        info1.roundSpeed = 8.5;
        info1.weapon = new Item(15,5);
        info1.listInt = new List<int>() { 45646,464568,34,3535};
        info1.itemList = new List<Item>() { new Item(1,12), new Item(2, 152) };
        info1.itemDic = new Dictionary<int, Item>() { { 2, new Item(14, 233) }, { 33, new Item(14, 233) } };
        info1.itemDic2 = new Dictionary<string, Item>() { { "232", new Item(14, 233) }, { "65", new Item(144, 233) } };

        string path = Application.streamingAssetsPath + "/te2.json";
        File.WriteAllText(path, JsonUtility.ToJson(info1));


        string jsonText = File.ReadAllText(path);
        PlayerInfo info = JsonUtility.FromJson<PlayerInfo>(jsonText);
        print("f");
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
